﻿/* Write a program that reads a string from the console and replaces all series of consecutive identical letters with a single one. Example: "aaaaabbbbbcdddeeeedssaa"  "abcdedsa". */

using System;
using System.Text.RegularExpressions;

namespace _23.ReadString
{
    class ReadString
    {
        static void Main()
        {
            string str = "find my different words bbbbbbbbbbbbbbbbbbbiiiiiiiiiiiiiitttttttttttccccccccccccchhhhhhhhhh bitch";

            Regex r = new Regex(@"(\w)\1+", RegexOptions.Compiled);
            Console.WriteLine(r.Replace(str, "$1"));
        }
    }
}
